$(function(){

	num = 0;

	function run() {

		// alert(888)
		$('.img_item').eq(num).fadeIn().siblings().fadeOut();

		$('.click_btn').eq(num).css('background','rgba(255,255,255,0.8)').siblings().css('background', 'rgba(0,0,0,0.6)');

		if(num== $('.img_item').length-1){
			num = 0;
		}else{
			num++;
		}
		
	}

	time = setInterval(run,1000);

	$('.banner').hover(function() {
		clearInterval(time)
	}, function() {
		time = setInterval(run,1000);
	});

	$('.click_right').click(function(event) {
		run();
	});

	$('.click_left').click(function(event) {

		if(num==1){
			num = $('.img_item').length-1;
		}else if(num==0){
			num = $('.img_item').length-2;
		}else{
			num -=2;
		}

		run();
		
	});

	$('.click_btn').click(function(event) {
		num = $(this).index();
		run();
	});


	$('.car').hover(function() {
		$('.cart_detail').stop().slideDown(200);
	}, function() {
		$('.cart_detail').stop().slideUp(300);
	});















})
